home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
201-225
/
223
/
popinfo
/
yesno.c
< prev
Wrap
C/C++ Source or Header
|
1995-03-13
|
2KB
|
58 lines
#include <intuition/intuitionbase.h>
#include <stdio.h>
#include <ctype.h>
#include <pragma/all.h>
#include <proto/all.h>
#include "PopInfo.i"
#define OKAY 1
#define CANCEL 0
static short YesNoXYBorder[]={
0,0,101,0,101,12,0,12,0,0};
static struct Border YesNoBorder={
-1,-1,1,0,JAM1,5,YesNoXYBorder,NULL};
static struct IntuiText OkayText={
1,1,JAM1,5,2,NULL," OKAY",NULL};
static struct IntuiText CancelText={
1,1,JAM1,5,2,NULL," CANCEL",NULL};
static struct Gadget OkayGadget={
NULL,8,20,100,11,GADGHCOMP,RELVERIFY,BOOLGADGET,
(APTR)&YesNoBorder,NULL,&OkayText,NULL,NULL,OKAY,NULL};
static struct Gadget CancelGadget={
&OkayGadget,120,20,100,11,GADGHCOMP,RELVERIFY,BOOLGADGET,
(APTR)&YesNoBorder,NULL,&CancelText,NULL,NULL,CANCEL,NULL};
static struct IntuiText YesNoText={
1,1,JAM1,8,7,NULL,NULL,NULL};
static struct NewWindow YesNoWindow={
50,30,230,36,0,3,GADGETUP|VANILLAKEY,ACTIVATE|RMBTRAP,&CancelGadget,
NULL,NULL,NULL,NULL,0,0,0,0,CUSTOMSCREEN};
static struct Window *QWindow;
static struct IntuiMessage *MyMsg;
static struct IntuitionBase *IntuitionBase;
YesNo(text)
char *text;
{
int Class,Code;
char key;
IntuitionBase=(struct IntuitionBase *) OpenLibrary("intuition.library",0);
YesNoWindow.Screen=(struct Screen *) IntuitionBase->ActiveScreen;
QWindow=(struct Window *) OpenWindow(&YesNoWindow);
YesNoText.IText=text;
PrintIText(QWindow->RPort,&YesNoText,0,0);
waitforinput:
Wait (1<<QWindow->UserPort->mp_SigBit);
MyMsg=GetMsg(QWindow->UserPort);
ReplyMsg(MyMsg);
Class=MyMsg->Class; Code=MyMsg->Code; key=toupper((char ) Code);
if (Class==VANILLAKEY && key!='Y' && key!='N') goto waitforinput;
CloseWindow(QWindow);
CloseLibrary(IntuitionBase);
if (((struct Gadget *) MyMsg->IAddress)->GadgetID==OKAY || key=='Y') return(TRUE);
return(FALSE);
}